package cn.spring.framework.redis.excutor;

import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

/**
 * @author xingkong
 * @Title: SyncCacheExecutor
 * @Description: 同步执行任务，调用当前线程运行
 * @date 2021/11/12 17:48
 */
public class SyncCacheExecutor<T> implements CacheExecutor<T>  {
    @Override
    public Future<T> executor(CacheTask<T> task) {
        FutureTask<T> futureTask = new FutureTask<>(task);
        futureTask.run();
        return new FutureAdapter<>(futureTask);
    }
}
